import { $http } from '@/utils';
import { $ResponseCode } from '@/utils/const/env';
export const Collect = {
    service(id: any) {
        return new Promise((resolve, reject) => {
            $http.get('Collect/service', {
                data: {
                    id
                }
            }).then((res: any) => {
                if (res.code === $ResponseCode.SUCCESS) {
                    resolve(res.data);
                } else {
                    reject(res);
                }
            }).catch(() => {
                reject({ msg: '服务器繁忙，请稍后再试' });
            })
        })
    },
    serviceList(query: any) {
        return new Promise((resolve, reject) => {
            $http.get('Collect/serviceList', {
                data: query
            }).then((res: any) => {
                if (res.code === $ResponseCode.SUCCESS) {
                    resolve(res.data);
                } else {
                    reject(res);
                }
            }).catch(() => {
                reject({ msg: '服务器繁忙，请稍后再试' });
            })
        })
    },
    technician(id: any) {
        return new Promise((resolve, reject) => {
            $http.get('Collect/technician', {
                data: {
                    id
                }
            }).then((res: any) => {
                if (res.code === $ResponseCode.SUCCESS) {
                    resolve(res.data);
                } else {
                    reject(res);
                }
            }).catch(() => {
                reject({ msg: '服务器繁忙，请稍后再试' });
            })
        })
    },
    technicianList(query: any) {
        return new Promise((resolve, reject) => {
            $http.get('Collect/technicianList', {
                data: query
            }).then((res: any) => {
                if (res.code === $ResponseCode.SUCCESS) {
                    resolve(res.data);
                } else {
                    reject(res);
                }
            }).catch(() => {
                reject({ msg: '服务器繁忙，请稍后再试' });
            })
        })
    },
    shop(id: any) {
        return new Promise((resolve, reject) => {
            $http.get('Collect/shop', {
                data: {
                    id
                }
            }).then((res: any) => {
                if (res.code === $ResponseCode.SUCCESS) {
                    resolve(res.data);
                } else {
                    reject(res);
                }
            }).catch(() => {
                reject({ msg: '服务器繁忙，请稍后再试' });
            })
        })
    }
}